package com.ruoyi.yljf.controller.AppController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.yljf.domain.Banner;
import com.ruoyi.yljf.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

/**
 * 轮播图Controller
 * 
 * @author metaee
 * @date 2025-04-28
 */
@RestController
@RequestMapping("/api/banner")
public class ApiBannerController extends BaseController {
    @Autowired
    private IBannerService bannerService;

    /**
     * 查询轮播图列表
     */
    @GetMapping("/list")
    public TableDataInfo list(String type) {
        startPage();
        List<Banner> list = bannerService.selectBannerList(Banner.builder().type(type).build());
        return getDataTable(list);
    }
//
//
//    /**
//     * 获取轮播图详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('yljf:banner:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id) {
//        return success(bannerService.getById(id));
//    }
//
//    /**
//     * 新增轮播图
//     */
//    @PreAuthorize("@ss.hasPermi('yljf:banner:add')")
//    @Log(title = "轮播图", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody Banner banner) {
//        return toAjax(bannerService.save(banner));
//    }
//
//    /**
//     * 修改轮播图
//     */
//    @PreAuthorize("@ss.hasPermi('yljf:banner:edit')")
//    @Log(title = "轮播图", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody Banner banner) {
//        return toAjax(bannerService.updateById(banner));
//    }
//
//    /**
//     * 删除轮播图
//     */
//    @PreAuthorize("@ss.hasPermi('yljf:banner:remove')")
//    @Log(title = "轮播图", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids) {
//        return toAjax(bannerService.removeByIds(Arrays.asList(ids)));
//    }
}
